import { Navigate } from "react-router-dom";
const withAuth = (Com) => {
  const token = localStorage.getItem("token");
  return () => {
    if (token) {
      return <Com></Com>;
    } else {
      return <Navigate to="/login"></Navigate>;
    }
  };
};

export default withAuth;
